<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title> 
        <link rel="stylesheet" type="text/css" href="../js/bootstarp-3.3.7/css/bootstrap.min.css"/>
        <!--<script src="js/jquery-3.2.0.min.js" type="text/javascript" charset="utf-8"></script>-->
        <script src="../js/jquery/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
        <link rel="stylesheet" type="text/css" href="../js/bootstarp-table-1.11.1/bootstrap-table.min.css"/>
        <script type="text/javascript"  charset="utf-8" src="../js/bootstarp-table-1.11.1/bootstrap-table.min.js" ></script>
        <script src="../js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>
      <script>
    $(function () {  //, headers: { 'x-requested-with': 'XMLHttpRequest' }
        $.ajaxSetup({crossDomain: true, xhrFields: {withCredentials: true}});
    });
	</script>
		<script type="text/javascript">
			$(function(){
	
				
				
////				
				$.ajax({
					type:"get",
					url:"http://127.0.0.1:8099/auth/quanxianrz",
					dataType:"json",
//					xhrFields:{withCredentials:true},
				
                    success:function(data){
//                  	alert(data.code)
                    if (data.code=="1000001") {
                    	alert("错误代码 1000001:"+data.msg)
//                  	location.href="../login.html"
                    } else if(data.code=="1000002"){
                    	alert("错误代码 1000002:"+data.msg)
//                  	window.location="http://192.168.216.1:8020/hissys/login.html"
                    }else if (data.code=="1000003") {
                    	alert("错误代码 1000003:"+data.msg)
//                  	location.href="../login.html"
                    }else if (data.code=="1000000") {
                    	alert("错误代码 1000000:"+data.msg)
//                  	location.href="../login.html"
                    }else if(data.code=="2") {
//                  	alert(data.code)
                   		 $("#t1").bootstrapTable({
					url: "http://127.0.0.1:8099/auth/allrules",
					pagination:true,
					pageSize:5, 
					columns: [{
						field: 'id',
						title: '序号',
						align: 'center'
					},{
						field: 'title',
						title: '职务名称',
						align: 'center'
					},{
						title: '操作',
						align: 'center',
						formatter: function(value,row,index) {
                           return '<button class="btn btn-info" onclick="selectOne('+row.id+')"  data-target="#myModal2">查看权限</button>'
						}
					}]

				})
                   } 	
                  }  
				});
				
				
				
			})
			
			
			
			function selectOne(id){
//				alert(id)
				$.ajax({
					type:"get",
					url:"http://127.0.0.1:8099/auth/findOneAuth",
					data:"id="+id,
					success:function(data){
						localStorage.setItem("id",data);
						location.href="selectAuth.html"
					}
				});
				
			}

			
		</script>
	</head>
	<body>
		
		
		<table id="t1">
			
			
		</table>
	</body>
</html>
